﻿using FFmpeg.AutoGen;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace AJWPFAdmin.Core.HardwareSDKS.FFmpeg
{

    public class FFmpegUtil
    {
        public FFmpegUtil() { }
        private static FFmpegUtil _instance = null;
        public static FFmpegUtil Instance => _instance ?? (_instance = new FFmpegUtil());

        public static AVHWDeviceType HWtype = AVHWDeviceType.AV_HWDEVICE_TYPE_NONE;

        public static void Init()
        {
            FFmpegBinariesHelper.RegisterFFmpegBinaries();
        }

        public static void ConfigureHWDecoder()
        {
            var type = AVHWDeviceType.AV_HWDEVICE_TYPE_NONE;

            while ((type = ffmpeg.av_hwdevice_iterate_types(type)) != AVHWDeviceType.AV_HWDEVICE_TYPE_NONE)
            {
                HWtype = type;
                break;
            }
        }

        public bool IsNetwork
        {
            get
            {
                return _IsNetwork;
            }

            set
            {
                _IsNetwork = value;
            }
        }

        public bool IsAlert
        {
            get
            {
                return _IsAlert;
            }

            set
            {
                _IsAlert = value;
            }
        }

        private bool _IsNetwork = true;
        private bool _IsAlert = true;


    }
}
